WGCNA.ModuleTrait <- function(Title,phenotype){
  traitData <- phenotype
  dim(traitData)
  ### 模块与表型数据关联
  if (corType=="pearson") {
    modTraitCor = cor(MEs_col, traitData, use = "p")
    modTraitP = corPvalueStudent(modTraitCor, nSamples)
  } else {
    modTraitCorP = bicorAndPvalue(MEs_col, traitData, robustY=robustY)
    modTraitCor = modTraitCorP$bicor
    modTraitP   = modTraitCorP$p
  }
  
  ## Warning in bicor(x, y, use = use, ...): bicor: zero MAD in variable 'y'.
  ## Pearson correlation was used for individual columns with zero (or missing)
  ## MAD.
  
  # signif表示保留几位小数
  textMatrix = paste(signif(modTraitCor, 2), "\n(", signif(modTraitP, 1), ")", sep = "")
  dim(textMatrix) = dim(modTraitCor)
  pdf(file = paste(Title,"Module_trait.pdf",sep = "."),width = 20,height = 10)
  labeledHeatmap(Matrix = modTraitCor, xLabels = colnames(traitData), 
                 yLabels = colnames(MEs_col), 
                 cex.lab = 0.7, xLabelsAngle = 45, xLabelsAdj = 1,
                 ySymbols = substr(colnames(MEs_col),3,1000), colorLabels = FALSE, 
                 colors = blueWhiteRed(50), 
                 textMatrix = textMatrix, setStdMargins = FALSE, 
                 cex.text = 0.6, zlim = c(-1,1),
                 main = paste("Module-trait relationships"))
  dev.off()
}
